package de.moc.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class ResultBar extends Composite {
	Image image;
	Label label;
	public ResultBar(long count) {
		VerticalPanel verticalPanel = new VerticalPanel();
		verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		image = new Image("bar.png");
		verticalPanel.add(image);
		label = new Label(String.valueOf(count));
		label.setStyleName("resultBar");
		verticalPanel.add(label);
		initWidget(verticalPanel);
	}
	
	public void setWidth(long width){
		image.setWidth(String.valueOf(width) + "pt");
	}
	
	public void setHeight(long height){
		if (height <= 0)
			height = 1;
		
		image.setHeight(String.valueOf(height) + "pt");
	}
}
